<?php

use Phalcon\Mvc\Model;

class Answers extends Model
{
	protected $id;
	protected $user;
	protected $test;
	protected $no;
	protected $test_db;
	protected $choice;
	protected $checked;


	public function getSource()
	{
		return "ot_answer";
	}

	public function initialize()
	{
		$this->belongsTo("test_db", "TestDetails", "id");
		$this->belongsTo("test", "Tests", "id");
		$this->belongsTo("user", "Users", "id");
	}

	public function getNo()
	{
		return $this->no;
	}

	public function setUser($user)
	{
		$this->user = $user;
	}

	public function setTest($test)
	{
		$this->test = $test;
	}

	public function getTest()
	{
		return $this->test;
	}

	public function setNo($no)
	{
		$this->no = $no;
	}

	public function setChoice($choice)
	{
		if(is_numeric($choice))
		{
			if($choice >= 0 && $choice < 5)
			{
				$this->choice = $choice;
				return true;
			}
		}
		return false;
	}

	public function getChoice()
	{
		return $this->choice;
	}

	public function setTest_db($test_db)
	{
		$this->test_db = $test_db;
	}

	public function setChecked($checked)
	{
		$this->checked = $checked;
	}
}